package com.kfm.am;

import java.util.Date;

public enum Why {

    WHY();

    private String why;
    private Date date;

    Why() {
        this.date = new Date();
        setWhy();
    }

    private void setWhy() {
        String why = "";
        int hour = date.getHours();
        if (hour > 6 && hour <= 8) {
            why = "早上好";
        } else if (hour > 8 && hour <= 11) {
            why = "中午好";
        } else if (hour > 11 && hour <= 18) {
            why = "下午好";
        } else if (hour > 18 && hour <= 21) {
            why = "晚上好";
        } else {
            why = "凌晨好";
        }
        this.why = why;
    }

    public String getWhy() {
        return why;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
        setWhy();
    }
}

class Test05 {

    public static void main(String[] args) {
        System.out.println(Why.WHY.getWhy());
    }
}

